﻿using Engine.Graphics;
using Engine.Graphics.VertexStructures;
using System.Collections.Generic;
using System.IO;

namespace Engine.AddinManager
{
    /// <summary>
    /// Addin where all engine relevated objects are created.
    /// </summary>
    public interface IAddin
    {
        #region Public Properties

        Graphics.IShaderArray ShaderArray { get; }

        #endregion Public Properties

        #region Public Methods

        /// <summary>
        /// Create an empty material. This will be need when loading a model where no materials for this addin exists.
        /// </summary>
        /// <returns></returns>
        IMaterial CreateEmptyMaterial(MaterialManager materialManager);

        /// <summary>
        /// Creates a new gamevertex.
        /// </summary>
        /// <param name="vertex"></param>
        Graphics.IGameVertex CreateGameVertice(MyOwnVertex.PositionNormalTextured vertex);

        string GetGameName();

        int GetSizeOfVertex();

        Graphics.IMaterial LoadMaterial(System.IO.BinaryReader br, Graphics.MaterialManager materialManager);

        Graphics.IMaterial LoadMaterialXml(System.Xml.XmlTextReader reader, Graphics.MaterialManager materialManager);

        /// <summary>
        /// Load game vertices by stream. Its just for old meshes.
        /// </summary>
        /// <param name="engineVertices">corresponding enginevertices to the gamevertices.</param>
        /// <param name="numberOfVertices"></param>
        /// <param name="vertexReader"></param>
        /// <param name="BlockSize"></param>
        /// <returns></returns>
        List<IGameVertex> LoadVerticesFromStream(List<MyOwnVertex.PositionNormalTextured> engineVertices, int numberOfVertices, BinaryReader vertexReader, int BlockSize, int vertexVersion);

        /// <summary>
        /// Load game vertices by stream.
        /// </summary>
        /// <param name="numberOfVertices"></param>
        /// <param name="vertexReader"></param>
        /// <param name="BlockSize"></param>
        /// <returns></returns>
        List<IGameVertex> LoadVerticesFromStream(int numberOfVertices, BinaryReader vertexReader, int BlockSize, int vertexVersion);

        /// <summary>
        /// Create new Array with type of your gamevertex-type and copy vertices to new array and
        /// use "standardGraphicBuffers.UpdateVertexBufferGameData(..)" to update the vertexbuffer.
        /// </summary>
        /// <param name="standardGraphicBuffers"></param>
        /// <param name="vertices"></param>
        void UpdateVertexBuffer(StandardGraphicBuffers standardGraphicBuffers, IGameVertex[] vertices);

        #endregion Public Methods
    }
}